Skip to main content

Installing Firebase

Installing firebase and axios

Install Firebase

npm install firebase

Install Axios

npm install axios

If using firebase with node and browser environment

  • add the following in the gatsby-node.js
exports.onCreateWebpackConfig = ({ actions, stage }) => {
if (stage === "develop-html" || stage === "build-html") {
actions.setWebpackConfig({
resolve: {
mainFields: ["main"],
},
})
} else {
actions.setWebpackConfig({
resolve: {
mainFields: ["browser", "module", "main"],
},
})
}
}

Download the template

  • Download the file in this repo
  • Paste it in the components folder

Creating config

  • Create the config file
touch src/components/Firebase/config.js
  • Add the export option below the file
export default firebaseConfig;